<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="companyId" name="companyId" value="${wechatCompany.companyId!}" >
          <div class="layui-form-item">
              <label class="layui-form-label">企业名字</label>
              <div class="layui-input-block">
                  <input type="text" id="companyName" name="companyName" value="${wechatCompany.companyName!}"  autocomplete="off" placeholder="请输入企业名字"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">企业资质验证</label>
              <div class="layui-input-block">
                  <input type="text" id="companyQualification" name="companyQualification" value="${wechatCompany.companyQualification!}"  autocomplete="off" placeholder="请输入企业资质验证"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">营业执照图片</label>
              <div class="layui-input-block">
                  <input type="text" id="companyLicenseImg" name="companyLicenseImg" value="${wechatCompany.companyLicenseImg!}"  autocomplete="off" placeholder="请输入营业执照图片"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">关联用户的ID</label>
              <div class="layui-input-block">
                  <input type="text" id="userId" name="userId" value="${wechatCompany.userId!}"  autocomplete="off" placeholder="请输入关联用户的ID"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">创建时间</label>
              <div class="layui-input-block">
                  <input type="text" id="companyCreateTime" name="companyCreateTime" value="${wechatCompany.companyCreateTime!}"  autocomplete="off" placeholder="请输入创建时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">修改时间</label>
              <div class="layui-input-block">
                  <input type="text" id="companyUpdateTime" name="companyUpdateTime" value="${wechatCompany.companyUpdateTime!}"  autocomplete="off" placeholder="请输入修改时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">是否删除 0正常 / 1已删除</label>
              <div class="layui-input-block">
                  <input type="text" id="companyIsDelete" name="companyIsDelete" value="${wechatCompany.companyIsDelete!}"  autocomplete="off" placeholder="请输入是否删除 0正常 / 1已删除"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">企业备注</label>
              <div class="layui-input-block">
                  <input type="text" id="companyRemarks" name="companyRemarks" value="${wechatCompany.companyRemarks!}"  autocomplete="off" placeholder="请输入企业备注"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">企业区域ID </label>
              <div class="layui-input-block">
                  <input type="text" id="areaId" name="areaId" value="${wechatCompany.areaId!}"  autocomplete="off" placeholder="请输入企业区域ID "
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">企业规模</label>
              <div class="layui-input-block">
                  <input type="text" id="companyScale" name="companyScale" value="${wechatCompany.companyScale!}"  autocomplete="off" placeholder="请输入企业规模"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">企业Logo</label>
              <div class="layui-input-block">
                  <input type="text" id="companyLogo" name="companyLogo" value="${wechatCompany.companyLogo!}"  autocomplete="off" placeholder="请输入企业Logo"
                         class="layui-input">
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         companyId:$("#companyId").val(),
                         companyName:$("#companyName").val(),
                         companyQualification:$("#companyQualification").val(),
                         companyLicenseImg:$("#companyLicenseImg").val(),
                         userId:$("#userId").val(),
                         companyCreateTime:$("#companyCreateTime").val(),
                         companyUpdateTime:$("#companyUpdateTime").val(),
                         companyIsDelete:$("#companyIsDelete").val(),
                         companyRemarks:$("#companyRemarks").val(),
                         areaId:$("#areaId").val(),
                         companyScale:$("#companyScale").val(),
                           companyLogo:$("#companyLogo").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/WeChatUser/wechatCompany/admin/editWechatCompany",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/WeChatUser/wechatCompany/admin/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#companyName").val().length<1){
                       layer.msg("请输入企业名字");
                       return false;
                   }
                   if($("#companyQualification").val().length<1){
                       layer.msg("请输入企业资质验证");
                       return false;
                   }
                   if($("#companyLicenseImg").val().length<1){
                       layer.msg("请输入营业执照图片");
                       return false;
                   }
                   if($("#userId").val().length<1){
                       layer.msg("请输入关联用户的ID");
                       return false;
                   }
                   if($("#companyCreateTime").val().length<1){
                       layer.msg("请输入创建时间");
                       return false;
                   }
                   if($("#companyUpdateTime").val().length<1){
                       layer.msg("请输入修改时间");
                       return false;
                   }
                   if($("#companyIsDelete").val().length<1){
                       layer.msg("请输入是否删除 0正常 / 1已删除");
                       return false;
                   }
                   if($("#companyRemarks").val().length<1){
                       layer.msg("请输入企业备注");
                       return false;
                   }
                   if($("#areaId").val().length<1){
                       layer.msg("请输入企业区域ID ");
                       return false;
                   }
                   if($("#companyScale").val().length<1){
                       layer.msg("请输入企业规模");
                       return false;
                   }
                   if($("#companyLogo").val().length<1){
                       layer.msg("请输入企业Logo");
                       return false;
                   }
        }
    });

</script>
</body>
</html>